<%@ page language="java" contentType="text/html; charset=utf-8 " import="domain.Article,java.util.*,service.article.*"
pageEncoding="utf-8"%>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta charset="utf-8" />
		<meta charset="utf-8">
		<title>文章列表</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="format-detection" content="telephone=no">
		<link rel="stylesheet" href="../../layui/css/layui.css" media="all" />
		<link rel="stylesheet" type="text/css" href="../../css/public.css"/>
		<link rel="stylesheet" type="text/css" href="news.css"/>
		

	</head>
<%
    ArticleService articleService = new ArticleServiceImpl();
        List<Article> list = articleService.getArticleList();
%>
	<body class="childrenBody">

			<blockquote class="layui-elem-quote quoteBox">
				
					<div class="layui-inline">
						<a class="layui-btn  addNews_btn" href="newsAdd.jsp">添加文章</a>
					</div>
					
			</blockquote>

		<div class="layui-form layui-border-box layui-table-view" lay-filter="LAY-table-1" style=" ">
			<div class="layui-table-box">
				<div class="layui-table-header">
					<table cellspacing="0" cellpadding="0" border="0" class="layui-table">
						<thead>
							<tr>
								<th data-field="0" data-unresize="true">
									<div class="layui-table-cell laytable-cell-1-0 laytable-cell-checkbox">
										<input type="checkbox" name="layTableCheckbox" lay-skin="primary" lay-filter="layTableAllChoose">
										<div class="layui-unselect layui-form-checkbox" lay-skin="primary">
											<i class="layui-icon layui-icon-ok"></i>
										</div>
									</div>
								</th>
								<th data-field="newsId">
									<div class="layui-table-cell laytable-cell-1-newsId" align="center">
										<span>ID</span>
									</div>
								</th>
								<th data-field="newsName">
									<div class="layui-table-cell laytable-cell-1-newsName">
										<span>文章标题</span>
									</div>
								</th>
                                <th data-field="newstype">
                                	<div class="layui-table-cell laytable-cell-1-newsName">
                                		<span>所属模块</span>
                                	</div>
                                </th>
								<th data-field="newsStatus">
									<div class="layui-table-cell laytable-cell-1-newsStatus" align="center">
										<span>发布状态</span>
									</div>
								</th>
								<th data-field="newsTime" data-minwidth="110">
									<div class="layui-table-cell laytable-cell-1-newsTime" align="center">
										<span>时间</span>
									</div>
								</th>
								<th data-field="8">
									<div class="layui-table-cell laytable-cell-1-8" align="center">
										<span>操作</span>
									</div>
								</th>
							</tr>
						</thead>
					</table>
				</div>
				<div class="layui-table-body layui-table-main">
					<table cellspacing="0" cellpadding="0" border="0" class="layui-table">
						<tbody>
						<%
                            for(int i =0; i<list.size();i++){
						%>
							<tr data-index="0" class="">
								<td data-field="0">
									<div class="layui-table-cell laytable-cell-1-0 laytable-cell-checkbox">
										<input type="checkbox" name="layTableCheckbox" lay-skin="primary">
										<div class="layui-unselect layui-form-checkbox" lay-skin="primary">
											<i class="layui-icon layui-icon-ok"></i>
										</div>
									</div>
								</td>
								<td data-field="newsId" align="center">
									<div class="layui-table-cell laytable-cell-1-newsId"><%=list.get(i).getId() %></div>
								</td>
								<td data-field="newsName">
									<div class="layui-table-cell laytable-cell-1-newsName">
										<%=list.get(i).getTitle() %>
									</div>
								</td>
								<td data-field="newsType">
                                	<div class="layui-table-cell laytable-cell-1-newsName">
                                			<% if(list.get(i).getType()==1){ %>公司资讯
                                			<% }if(list.get(i).getType()==2){ %>日本留学<% }if(list.get(i).getType()==3){%>
                                			旅程规划<% } %>
                                	</div>
                                </td>
								
								
								<td data-field="newsStatus" align="center" data-content="1">
									<div class="layui-table-cell laytable-cell-1-newsStatus">
									<% if(list.get(i).getState()==0) {%>
									草稿<% }if(list.get(i).getState()==1) { %>
									已发布<% } %>
									</div>
								</td>
								<td data-field="newsTime" align="center" data-content="2017-04-14 00:00:00" data-minwidth="110">
									<div class="layui-table-cell laytable-cell-1-newsName"><%=list.get(i).getChangeTime() %></div>
								</td>
								<td data-field="8" align="center" data-content="">
									<div class="layui-table-cell laytable-cell-1-8">
										<a class="layui-btn layui-btn-xs" lay-event="edit" href="newsAdd.jsp?id=<%=list.get(i).getId() %>">编辑</a>
										<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del" href="../../../DeleteNews?id=<%=list.get(i).getId() %>">删除</a>
									</div>
								</td>
							</tr>
							<% } %>
						</tbody>
					</table>
				</div>
				<div class="layui-table-fixed layui-table-fixed-l">
					<div class="layui-table-header">
						<table cellspacing="0" cellpadding="0" border="0" class="layui-table">
							<thead>
								<tr>
									<th data-field="0" data-unresize="true">
										<div class="layui-table-cell laytable-cell-1-0 laytable-cell-checkbox">
											<input type="checkbox" name="layTableCheckbox" lay-skin="primary" lay-filter="layTableAllChoose">
											<div class="layui-unselect layui-form-checkbox" lay-skin="primary">
												<i class="layui-icon layui-icon-ok"></i>
											</div>
										</div>
									</th>
									<th data-field="newsId">
										<div class="layui-table-cell laytable-cell-1-newsId" align="center">
											<span>ID</span>
										</div>
									</th>
								</tr>
							</thead>
						</table>
					</div>
					<div class="layui-table-body" style="height: auto;">
						<table cellspacing="0" cellpadding="0" border="0" class="layui-table">
							<tbody>
							<%
                                                        for(int i =0; i<list.size();i++){
                            						%>
								<tr data-index="0" class="">
									<td data-field="0">
										<div class="layui-table-cell laytable-cell-1-0 laytable-cell-checkbox">
											<input type="checkbox" name="layTableCheckbox" lay-skin="primary">
											<div class="layui-unselect layui-form-checkbox" lay-skin="primary">
												<i class="layui-icon layui-icon-ok"></i>
											</div>
										</div>
									</td>
									<td data-field="newsId" align="center">
										<div class="layui-table-cell laytable-cell-1-newsId"><%=list.get(i).getId() %></div>
									</td>
								</tr>
								<% } %>
						</tbody>
					</table>
				</div>
			</div>
			<div class="layui-table-fixed layui-table-fixed-r" style="right: -1px;">
				<div class="layui-table-header">
					<table cellspacing="0" cellpadding="0" border="0" class="layui-table">
						<thead>
							<tr>
								<th data-field="8">
									<div class="layui-table-cell laytable-cell-1-8" align="center">
										<span>操作</span>
									</div>
								</th>
							</tr>
						</thead>
					</table>
					<div class="layui-table-mend"></div>
				</div>
				<div class="layui-table-body" style="height: auto;">
					<table cellspacing="0" cellpadding="0" border="0" class="layui-table">
						<tbody>
                            <%
                                                        for(int i =0; i<list.size();i++){
                            						%>
							<tr data-index="0" class="">
								<td data-field="8" align="center" data-content="">
									<div class="layui-table-cell laytable-cell-1-8"> 
										<a class="layui-btn layui-btn-xs" lay-event="edit" href="newsAdd.jsp?id=<%=list.get(i).getId() %>">编辑</a>
										<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del" href="../../../DeleteNews?id=<%=list.get(i).getId() %>">删除</a>
									</div>
								</td>
							</tr>
							<% } %>
						</tbody>
					</table>
				</div>
			</div>
		</div>
		<script type="text/javascript">
		    var x = <%=request.getParameter("msg") %>;
		    console.log(x);
		    if(x==1){
		        alert("操作成功");
		    }
		    if(x==0){
		        alert("操作失败");
		    }
		</script>
	<style>.laytable-cell-1-0{ width: 50px; }.laytable-cell-1-newsId{ width: 60px; }.laytable-cell-1-newsName{ width: 350px; }.laytable-cell-1-picture{ width: 170px; }.laytable-cell-1-newsStatus{ width: 95px; }.laytable-cell-1-newsLook{ width: 95px; }.laytable-cell-1-newsTop{ width: 95px; }.laytable-cell-1-newsTime{ width: 110px; }.laytable-cell-1-8{ width: 130px; }</style></div>
	</body>
</html>
